package com.yuehuanghun.admin.core.config;

import java.util.List;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.yuehuanghun.framework.web.resolver.LocalDateResolver;
import com.yuehuanghun.framework.web.resolver.LocalDateTimeResolver;

import cn.dev33.satoken.interceptor.SaAnnotationInterceptor;

@Configuration
public class RestAppConfigurer implements WebMvcConfigurer {
	
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new SaAnnotationInterceptor()).addPathPatterns("/**"); // 注册Sa-Token的注解拦截器
    }

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
        resolvers.add(new LocalDateResolver());
        resolvers.add(new LocalDateTimeResolver());
    }
}
